var status = 0;
        var choice;
        var itemxh = new Array("5840003","5840007");
        var itemxhcost = new Array("888","1200");
        function start() {
        status = - 1;
                action(1, 0, 0);
        }

function action(mode, type, selection) {
if (mode == - 1) cm.dispose();
        else {
        if (status == 0 && mode == 0) {
        cm.dispose();
                return;
        } else if (status >= 1 && mode == 0) {
        cm.sendOk("真的不考虑购买一些东西么？好的,欢迎下次继续光临！");
                cm.dispose();
                return;
        }
        if (mode == 1) status++;
                else status--;
                if (status == 0) {
        choices = "" +  cm.getServerName()+ "抽奖系统椅子系统已经与官方一样使用万花筒钥匙打开！您只需要去万能商店-杂货商店-购买#v2436876#-双击获得#v4009440#，然后再配合使用下面的万花筒钥匙就可以开出你意想不到的好东西哟！\r\n#r#e #n#b";
                for (var i = 0; i < itemxh.length; i++) {
        choices += "\r\n#b#L" + i + "##v" + itemxh[i] + "##z" + itemxh[i] + "#　#d需要#r" + itemxhcost[i] + "#d点卷#k#l";
        }
        cm.sendSimpleS("" + choices, 2);
        } else if (status == 1) {
        cm.sendGetNumber("你选择的商品为#b#v" + itemxh[selection] + "#售价为：" + itemxhcost[selection] + "点卷/张\r\n请输入你购买的数量", 1, 1, cm.getPlayer().getCSPoints(1));
                choice = selection;
        } else if (status == 2) {
        fee = selection;
                money = fee * itemxhcost[choice];
                if (fee < 0) {
        cm.sendOk("不能输入0.或者你没有足够的点卷支付你要买的数量.!");
                cm.dispose();
        } else if (cm.getPlayer().getCSPoints(1) < money) {
        cm.sendOk("购买失败，你没有" + money + "点卷");
                cm.dispose();
        } else {
        cm.gainNX( - money);
                cm.gainItem(itemxh[choice], fee);
     		    cm.worldSpouseMessage(0x0F, "[点卷商城] :玩家:" +"["+ cm.getChar().getName()+"]"+ " "+"在" +  cm.getServerName()+ "点卷商城豪华椅子区进行了赞助消费.");
                cm.sendOk("恭喜，购买成功。您的每一次赞助消费我们都很感激！");
                cm.dispose();
        }
        }
        }
}
